import request from '@/utils/request'

export function captchaImage() {
    return request({
        url: '/common/captcha',
        method: 'get',
        params: {}
    })
}

export function login(data) {
    return request({
        url: '/login',
        method: 'post',
        data
    })
}

export function logout() {
    return request({
        url: '/logout',
        method: 'post'
    })
}

export function getInfo() {
    return request({
        url: '/system/user/currentUserInfo',
        method: 'get',
        params: {}
    })
}

export function fetchUser(params) {
    return request({
        url: '/system/user',
        method: 'get',
        params: params
    })
}

export function remove(data) {
    return request({
        url: '/system/user/remove',
        method: 'delete',
        data
    })
}

export function create(data) {
    return request({
        url: '/system/user',
        method: 'post',
        data
    })
}

export function update(id, data) {
    return request({
        url: '/system/user/' + id,
        method: 'put',
        data
    })
}

export function info(id) {
    return request({
        url: '/system/user/' + id,
        method: 'get',
        params: {}
    })
}

export function getMenuTree() {
    return request({
        url: '/system/user/userMenu',
        method: 'get',
        params: {}
    })
}

export function editPassword(data) {
    return request({
        url: '/system/user/password',
        method: 'put',
        data
    })
}

export function onlineUser(params) {
    return request({
        url: '/system/user/online',
        method: 'get',
        params: params
    })
}

export function kick(params) {
    return request({
        url: '/system/user/kick',
        method: 'post',
        params: params
    })
}
